package com.hdd.biz.operate.controller;
import com.hdd.biz.operate.dto.LabelInfoRequest;
import com.hdd.biz.operate.dto.LabelListRequest;
import com.hdd.biz.operate.dto.LabelRequest;
import com.hdd.biz.operate.service.LabelService;
import com.hdd.dto.SuperResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fang
 * @since 2021-03-10
 */
@RestController
@RequestMapping("/operate/label")
@Api(value = "标签",tags = {"标签"})
@CrossOrigin(origins = "*",maxAge = 3600)
public class LabelController {


    @Autowired
    private LabelService labelService;

    @PostMapping("/list")
    @ApiOperation(value = "标签列表" ,notes = "")
    public SuperResponse list(@Valid @RequestBody LabelListRequest request ){
        return labelService.list(request);
    }

    @PostMapping("/info")
    @ApiOperation(value = "标签详情" ,notes = "")
    public SuperResponse info(@Valid @RequestBody LabelRequest request ){
        return labelService.info(request);
    }

    @PostMapping("/add")
    @ApiOperation(value = "标签添加" ,notes = "")
    public SuperResponse add(@Valid @RequestBody LabelInfoRequest request ){
        return labelService.add(request);
    }

    @PostMapping("/update")
    @ApiOperation(value = "标签修改" ,notes = "")
    public SuperResponse update(@Valid @RequestBody LabelInfoRequest request ){
        return labelService.update(request);
    }

    @PostMapping("/delete")
    @ApiOperation(value = "标签删除" ,notes = "")
    public SuperResponse delete(@Valid @RequestBody LabelRequest request ){
        return labelService.delete(request);
    }

}

